#!/usr/bin/env python
# -*- coding: utf-8 -*-

import re

class CommodityFutureCodeUtil:
    """
    期货具体合约与主力合约的code转换工具
    """

    @staticmethod
    def code_to_contract_code(code) -> str:
        """
        将具体合约的code转换为主力合约的code
        """

        code_str: str = re.sub("[\u4e00-\u9fa5\0-9\,\。]", "", code.split(".")[1])
        return code_str